<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/axios.js"></script>
    <link rel="stylesheet" href="css/login.css">
    <link rel="stylesheet" href="css/newbootstrap.css">
    <link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="css/aaaa.css">
</head>
<script src="js/index.js"></script>
<body>
<div id="headerTop">
    <div id="headerTop-next">
        <p>
            <a href="login.html">E宠首页</a>
        </p>
        <div class="songZ">送至：</div>
        <div class="diZ">北京</div>
        <p>
            <a href="login.html">E宠就是正品</a>
        </p>
    </div>
    <ul id="headerTop-Right">
        <li><a href="login.html">问题反馈</a></li>
        <li><i></i><a href="login.html">手机版</a></li>
        <li><i></i><a href="login.html">收藏</a><b></b></li>
        <li><i></i><a href="login.html">我的E宠</a><b></b></li>
        <li><i></i><a href="login.html">购物车(<span>0</span>)</a></li>
        <li><a href="login.html">[注册]</a></li>
        <li><a href="login.html">[登录]</a></li>
    </ul>
</div>
<div id="header-wrapper">
    <div id="header">
        <div id="header-logo">
            <a href="login.html"></a>
        </div>
        <div id="header-search">
            <div id="header-search-form">
                <input type="text" name="keyword" placeholder="K9Natural">
                <input type="button" value="搜索">
            </div>
            <div id="header-search-keyword">
                <label>热门搜索：</label>
                <a href="login.html">拜耳</a>
                <span>|</span>
                <a href="login.html">伯纳天地</a>
                <span>|</span>
                <a href="login.html">冠能</a>
                <span>|</span>
                <a href="login.html">麦德士</a>
                <span>|</span>
                <a href="login.html">粑粑抓</a>
            </div>
        </div>
        <div id="header-cart">
            <a href="login.html">购物车(<span>0</span>)</a>
        </div>
    </div>
</div>
<div id="nav">
    <div id="nav-main">
        <div id="nav-main-L">
            <span><a href="login.html">狗狗</a><b></b></span>
            <span>商品分类<b></b></span>
            
        </div>
        <ul id="nav-main-R">
            <li><a href="login.html"><b></b>品牌特卖</a></li>
            <li><a href="login.html"><b></b>潮品视频</a></li>
            <li><a href="login.html"><b></b>小剧场</a></li>
            <li><a href="login.html"><b></b>E宠课堂</a></li>
            <li><a href="login.html"><b></b>萌爪联盟</a></li>
            <li><a href="login.html"><b></b>清仓特价</a></li>
        </ul>
        <div id="nav-main-LD">
            <div id="LD-R">
                <ul>
                    <li>
                        <h3><a href="login.html">主粮</a><a href="login.html">零食</a></h3>
                        <div id="abox">
                            <div id="abox-1">
                                <div id="abox-1-top">
                                    <img src="img/狗狗主粮1.jpg" alt="">
                                    <a href="login.html">狗狗主粮</a>
                                    <i></i>
                                </div>
                                <div id="abox-1-2"></div>
                                <div id="abox-1-mid_head">
                                    <a href="login.html">进口狗粮</a>
                                    <img src="img/abox-1-mid_head.jpg" alt="">
                                </div>
                                <div id="abox-1-mid_list">
                                    <a href="login.html">小型犬专用</a>
                                    <a href="login.html">大型犬专用</a>
                                    <a href="login.html">大型犬幼犬专用</a>
                                    <a href="login.html">夏日清火</a>
                                </div>
                                <div id="abox-1-2"></div>
                                <div id="abox-1-mid_head">
                                    <a href="login.html">国产狗粮</a>
                                    <img src="img/abox-1-mid_head.jpg" alt="">
                                </div>
                                <div id="abox-1-mid_list">
                                    <a href="login.html">小型犬专用</a>
                                    <a href="login.html">大型犬专用</a>
                                    <a href="login.html">大型犬幼犬专用</a>
                                    <a href="login.html">夏日清火</a>
                                </div>
                                <div id="abox-1-2"></div>
                                <div id="abox-1-mid_head">
                                    <a href="login.html">国产狗粮</a>
                                    <img src="img/abox-1-mid_head.jpg" alt="">
                                </div>
                                <div id="abox-1-mid_list">
                                    <a href="login.html">小型犬专用</a>
                                    <a href="login.html">大型犬专用</a>
                                    <a href="login.html">大型犬幼犬专用</a>
                                    <a href="login.html">夏日清火</a>
                                </div>
                                <div id="abox-1-2"></div>
                                <div id="abox-1-top">
                                    <img src="img/狗狗主粮1.jpg" alt="">
                                    <a href="login.html">狗狗主粮</a>
                                    <i></i>
                                </div>
                                <div id="abox-1-2"></div>
                                <div id="abox-1-mid_head">
                                    <a href="login.html">进口狗粮</a>
                                    <img src="img/abox-1-mid_head.jpg" alt="">
                                </div>
                                <div id="abox-1-mid_list">
                                    <a href="login.html">小型犬专用</a>
                                    <a href="login.html">大型犬专用</a>
                                    <a href="login.html">大型犬幼犬专用</a>
                                    <a href="login.html">夏日清火</a>
                                </div>
                                <div id="abox-1-2"></div>
                                <div id="abox-1-mid_head">
                                    <a href="login.html">国产狗粮</a>
                                    <img src="img/abox-1-mid_head.jpg" alt="">
                                </div>
                                <div id="abox-1-mid_list">
                                    <a href="login.html">小型犬专用</a>
                                    <a href="login.html">大型犬专用</a>
                                    <a href="login.html">大型犬幼犬专用</a>
                                    <a href="login.html">夏日清火</a>
                                </div>
                                <div id="abox-1-2"></div>
                                <div id="abox-1-mid_head">
                                    <a href="login.html">国产狗粮</a>
                                    <img src="img/abox-1-mid_head.jpg" alt="">
                                </div>
                                <div id="abox-1-mid_list">
                                    <a href="login.html">小型犬专用</a>
                                    <a href="login.html">大型犬专用</a>
                                    <a href="login.html">大型犬幼犬专用</a>
                                    <a href="login.html">夏日清火</a>
                                </div>
                                <div id="abox-1-2"></div>
                                <div id="abox-1-mid_head">
                                    <a href="login.html">国产狗粮</a>
                                    <img src="img/abox-1-mid_head.jpg" alt="">
                                </div>
                                <div id="abox-1-mid_list">
                                    <a href="login.html">小型犬专用</a>
                                    <a href="login.html">大型犬专用</a>
                                    <a href="login.html">大型犬幼犬专用</a>
                                    <a href="login.html">夏日清火</a>
                                </div>
                            </div>
                        </div>
                    </li>
                    <li><h3><a href="login.html">窝垫</a><a href="login.html">玩具</a></h3></li>
                    <li><h3><a href="login.html">清洁</a><a href="login.html">保健</a></h3></li>
                    <li><h3><a href="login.html">护理</a><a href="login.html">生活</a></h3></li>
                    <li><h3><a href="login.html">牵引</a><a href="login.html">洗澡</a></h3></li>
                    <li><h3><a href="login.html">服饰</a><a href="login.html">美容</a></h3></li>
                </ul>
                <p>
                    <img src="img/nav-LD.png">
                    正在进行的品牌热卖
                    <a>52</a>
                </p>
            </div>
            <dl id="LD-L">
                <dd id="LD-L-dog">
                    <a href="login.html"><span></span></a>
                    <span class="LD-L-d">
                        <p><b>5401</b>种精选宝贝</p>
                        <a href="login.html">正在狗狗站溜达</a>  
                    </span> 
                    <a href="login.html"><img src="img/dogpack.jpg" alt=""></a>
                </dd>
                <dd id="LD-L-cat">
                    <a href="login.html"><span></span></a>
                    <span class="LD-L-cat">
                        <p><b>3806</b>种精选宝贝</p>
                        <a href="login.html">切换到猫猫站</a>
                    </span>
                    <a href="login.html"><img src="img/catpack.jpg"></a>
                </dd>
            </dl>
        </div>
    </div>
</div>
<div id="login-main">
    <div id="login-main-top">
        <div>
            <span>狗狗</span>
            <b></b>
        </div>
        <label></label>
        <div>
            <span>狗狗主粮</span>
            <b></b>
        </div>
        <label></label>
        <div>
            <span>进口狗粮</span>
            <b></b>
        </div>
    </div>
    <div id="login-main-aside">
        <div id="login-Amain-top">
            <h2>
                <span>狗狗主粮</span>
            </h2>
            <div>
                <a href="login.html"><img src="img/login-Amain-top.jpg" alt=""><span>进口狗粮</span> </a>
                <a href="login.html"><img src="img/login-Amain-top.jpg" alt=""><span>国产狗粮</span> </a>
                <a href="login.html"><img src="img/login-Amain-top.jpg" alt=""><span>冻干狗粮</span> </a>
            </div>
        </div>
        <div id="login-Amain-b">
            <span>未找到心仪的商品</span>
            <br>
            <br>
            <div>预定没有的商品</div>
        </div>
    </div>
    <div id="login-main-M">
        <div id="login-Mmain-top">
            <table id="login-Mmain-table1">
                <tr>
                    <th>品牌</th>
                    <td>
                        <div id="login-Mmain-td">
                            <div><a href="detail.html">全部</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                            <div><a href="detail.html">牛油果AVOerm</a></div>
                        </div>
                    </td>
                </tr>
            </table>
            <table id="login-Mmain-table2">
                <tr>
                    <th>主要配方:</th>
                    <td>
                        <a href="detail.html">鸡肉</a>
                        <a href="detail.html">鱼肉</a>
                        <a href="detail.html">火鸡肉</a>
                        <a href="detail.html">羊肉</a>
                        <a href="detail.html">牛肉</a>
                    </td>
                </tr>
                <tr>
                    <th>适合体量:</th>
                    <td>
                        <a href="detail.html">全部体型</a>
                        <a href="detail.html">小型犬</a>
                        <a href="detail.html">中型犬</a>
                        <a href="detail.html">大型犬</a>
                       
                    </td>
                </tr>
                <tr>
                    <th>颗粒大小:</th>
                    <td>
                        <a href="detail.html">标准粒</a>
                        <a href="detail.html">小颗粒</a>
                        <a href="detail.html">大颗粒</a>
                    
                    </td>
                </tr>
                <tr>
                    <th>适合年龄:</th>
                    <td>
                        <a href="detail.html">全部龄犬</a>
                        <a href="detail.html">成犬</a>
                        <a href="detail.html">幼犬</a>
                        <a href="detail.html">老犬</a>
                        <a href="detail.html">怀孕脯乳期犬</a>
                    </td>
                </tr>
                <tr>
                    <th>重量区间:</th>
                    <td>
                        <a href="detail.html">大包</a>
                        <a href="detail.html">小包</a>
                        <a href="detail.html">中包</a>
                        <a href="detail.html">超小包</a>
                        <a href="detail.html">超大包</a>
                    </td>
                </tr>
            </table>
        </div>
        <div id="login-Mmain-nav">
            <div id="login-Mmain-nav1">
                <div>
                    <a href=""><span>默认</span></a>
                    <a href=""><span>销量</span></a>
                    <a href=""><span>人气</span></a>
                    <a href=""><span>新品</span></a>
                    <a href=""><span>评论</span></a>
                    <a href=""><span>价格</span></a>
                </div>
            </div>
        </div>
        <div id="login-Mmain-List">
            
        </div>
    </div>
</div>
<script>
    var loadData =function(){
            let url ='http://jx.xuzhixiang.top/ap/api/allproductlist.php?'
            let uid = localStorage.getItem('uid')
            let token = localStorage.getItem('token')
            axios.get(url,{params:{uid,token}})
            .then(res=>{
                console.log(res.data.data)
                let arr = res.data.data;
                let abc = '';
                arr.forEach(obj=>{
                    console.log(obj.pimg)
                    abc+=`  <div class="list-product">
                            <img src="${obj.pimg}" alt="">
                            <a href="detail.html">${obj.pname}</a>
                            <p>${obj.pprice}￥</p>
                            <button data-id="${obj.pid}" class="delete-btn">加入购物车</button>
                        </div>`
                })
                let List =document.querySelector('#login-Mmain-List')
                List.innerHTML = abc;
                
                CreaCat() 
            })
            
        }
        loadData()
        function CreaCat() {
            // 接口地址：http://jx.xuzhixiang.top/ap/api/add-product.php
            // 接口请求方式：get
            // 接口参数：
            // uid  用户id
            // pid  商品id
            // pnum  要添加的商品数量
            
            let creatCat = document.querySelectorAll('.delete-btn');
            for (let i = 0; i < creatCat.length; i++) {
                creatCat[i].onclick = function () {
                    console.log
                }}
            for (let i = 0; i < creatCat.length; i++) {
                creatCat[i].onclick = function () {
                    let pnum = 1
                    let uid = localStorage.getItem('uid')
                    // pid  按钮上 属性里面
                    let pid = this.getAttribute('data-id')
                    let url = 'http://jx.xuzhixiang.top/ap/api/add-product.php'
                    axios.get(url, {
                        params: {
                            uid,pid,pnum
                        }
                    }).then(res => {
                        console.log(res);
                        location.href = 'cat.html'               
                    })
                }
            }
        }
        
</script>
<div id="footer">
    <div id="footer-top">
        <div id="footer-top-img">
            <ul class="footer-list">
                <li class="fl"><a class="zp" href="">正品保障</a></li>
                <li class="fl"><a class="ck"href="">品类丰富</a></li>
                <li class="fl"><a class="ps"href="">优质服务</a></li>
                <li class="fl"><a class="hh"href="">科学养宠</a></li>
                <li class="fl"><a class="bs"href="">E宠公益</a></li>
                <li class="fl"><a class="cj"href="">十年同心</a></li>
            </ul>
        </div>
    </div>
    <div id="footer-wrapper">
        <div id="ft-wrapper-top">
            <div id="ft-wrapper-topL">
                <img src="img/dog_phone.gif">
                <div id="ft-wrapper-number">
                    <h2 class="ft-number">售后电话</h2>
                    <p class="c660">4008889200<span class="m10">免费长途</span></p>
                    <p class="c660">023-68851700</p>
                    <p class="c440">服务时间：09:00--18:30(周一到周日)</p>
                </div>
            </div>
            <div id="ft-wrapper-topPay">
                <h2>购物指南</h2>
                <p class="topPay-p"><a href="#">新人优惠</a></p>
                <p class="topPay-p"><a href="#">购物问题</a></p>
                <p class="topPay-p"><a href="#">支付问题</a></p>
            </div>
            <div id="ft-wrapper-topShop">
                <h2>售后服务</h2>
                <p class="topShop-s"><a href="#">退换货问题</a></p>
                <p class="topShop-s"><a href="#">退款说明</a></p>
                <p class="topShop-s"><a href="#">售后问题</a></p>
            </div>
            <div id="ft-wrapper-topApp">
                <p class="topApp-a">扫码下载APP</p>
                <p class="topApp-a">下单更优惠</p>
                <a href="#">
                    <img src="img/dw2.png" alt="">
                </a>
            </div>
            <div id="ft-wrapper-topWx">
                <p class="topWx-w">扫码关注E宠</p>
                <p class="topWx-w">微信商城</p>
                <a href="#">
                    <img src="img/app-code.jpg" alt="">
                </a>
            </div>
        </div>
        <div id="ft-wrapper-Tnext">
            <div id="Tnext-wrapper">
                <span id="Tnext-wrapper-S">
                    <a href="#">关于我们</a>
                    <a href="#"><img src="img/weibo_logo.png">
                        E宠商城</a>
                    <a href="#"><img src="img/weixin_logo.png" >
                        E宠商城</a>
                    <a href="#"><img src="img/baidu_log.png" >
                        E宠商城百家号</a>
                    <a href="#"><img src="img/toutiao_logo.png">
                        E宠说</a>
                    <a href="#">E宠公益</a>
                    <a href="#">联系我们</a>
                    <a href="#">公司地址</a>
                    <a href="#">应急响应</a>
                    <a href="#">仓储中心</a>
                    <a href="#">用户协议</a>
                </span>
            </div>
        </div>
        <div id="ft-wrapper-support">
            <a href="#"><img src="img/12315.png" alt=""></a>
            <a href="#"><img src="img/360.png" alt=""></a>
            <a href="#"><img src="img/chengxin.png" alt=""></a>
            <a href="#"><img src="img/shiming.png" alt=""></a>
            <a href="#"><img src="img/tx.png" alt=""></a>
            <a href="#"><img src="img/jybz.png" alt=""></a>
            <a href="#"><img src="img/cqgs.png" alt=""></a>
            <span><img src="img/baiq.png" alt=""></span>
            <span><img src="img/wsls.png" alt=""></span>
            <span><img src="img/sfqy.png" alt=""></span>
            <span><img src="img/yxqy.png" alt=""></span>
            <span><img src="img/bhdw.png" alt=""></span>
            <span><img src="img/sjws.png" alt=""></span>
        </div>
        
        <div id="ft-wrapper-footer">
            <p>
                <a href="#">渝ICP备10002905号-3</a>
                <a href="#">营业执照</a>
                <a href="#">兽药经营许可证</a>
                　增值电信业务经营许可证：渝B2-20140042 Copyright © 2007-2020 epet.com 　重庆易宠科技有限公司
            </p>
        </div>
    </div>
</div>
<div id="rtcont">
    <ul id="rtcont-1">
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>
        <li></li>
    </ul>
    <ul id="rtcont-2">
        <a id="rtcont-2-1" href="#"></a>
    </ul>
</div>
<script src="js/jquery.js"></script>
<script>
    $(function() {
        $("#rtcont-2-1").hide();
        $(window).bind('scroll',function(){
            if($(window).scrollTop()<=300){
                $("#rtcont-2-1").hide();
           	}else{
                $("#rtcont-2-1").show();
            }
        });
        $("#rtcont-2-1").bind("click",function(){
            $('html, body').animate({scrollTop: 0},500);
        });
   });
   $(function(){
       $("#misc-con").hide();
        $("#headerTop-Right li:eq(6) a").click(function(){
            $("#misc-con").show();
        }); 
        $("#stop").click(function(){
        $("#misc-con").hide();
       })
   });
   $(function(){
     $("#register-con").hide();
        $("#headerTop-Right li:eq(5) a").click(function(){
            $("#register-con").show();
        }); 
       $("#stop").click(function(){
        $("#register-con").hide();
       })
   })
</script>
    <div id="misc-con">
        <div id="misc-con-main">
            <p>
                <span>手机验证码登录</span>
                <span>|</span>
                <span>账户登录</span>
            </p>
            <div>
                <span></span>
                <input id="misc-n" type="text" placeholder="请输入手机号">
            </div>
            <div>
                <span></span>
                <input id="misc-p" type="text" placeholder="请输入密码">
            </div>
            <div id="misc-b">登录</div>
        </div>
    </div>
    <div id="register-con">
        <span id="stop"></span>
        <div id="register-con-main">
            <p>
                <span>新用户注册</span>
                <span>|</span>
                <span>直接登录</span>
            </p>
            <div>
                <span></span>
                <input id="register-n" type="text" placeholder="请输入手机号">
            </div>
            <div>
                <span></span>
                <input id="register-p" type="text" placeholder="请输入密码">
            </div>
            <div id="register-b">注册</div>
        </div>
    </div>
    <script src="js/axios.js"></script>
    <script>
        let Ldr = document.getElementById('LD-R')
        let Navmain = document.getElementById('nav-main-L')
        Ldr.style.display = "none"
        Navmain.onmouseover = function(){
            Ldr.style.display = "block"
        }
        Navmain.onmouseout = function(){
            Ldr.style.display = "none"
        }
    </script>
    <script>
        let ipts = document.getElementById("register-b");
         ipts.onclick = function(){
             let username = document.getElementById("register-n").value
             let password = document.getElementById("register-p").value
             let regAPI = 'http://jx.xuzhixiang.top/ap/api/reg.php'
            axios.get(regAPI,{
                params:{
                    username,
                    password
                }
            }).then(function(res){
                //请求成功
                   if(res.data.code == 1){
                        alert("注册成功")
                       location.href = 'index.html'
                   }
                }).catch(function(err){
                    //请求失败
                    console.log(err)
                })
            }
            let ipt = document.getElementById("misc-b");
        ipt.onclick = function(){
        let name = document.getElementById("misc-n").value
        let word = document.getElementById("misc-p").value
        let reg = 'http://jx.xuzhixiang.top/ap/api/login.php'
            axios.get(reg,{
                params:{
                    username:name,
                    password:word
                }
            }).then(function(res){
                
                //请求成功
                   if(res.data.code == 1){
                        alert("登录成功")
                        console.log(res.data.data.id)
                        localStorage.setItem('uid',res.data.data.id)
                        localStorage.setItem('token',res.data.data.token)
                     location.href = 'index.html'
                   }
                }).catch(function(err){
                    //请求失败
                    console.log(err)
                })
            }
            
    </script>
    <script src="js/misc.js"></script>
</body>
</html>